function listToTreeList(list:any) { // 将普通列表转换为树结构的列表
    if (!list || !list.length) {
      return []
    }
    let treeListMap:any = {};
    for (let item of list) {
      treeListMap[item.id] = item
    }
    for (let i = 0; i < list.length; i++) {
      if (list[i].pid && treeListMap[list[i].pid]) {
        if (!treeListMap[list[i].pid].children) {
          treeListMap[list[i].pid].children = []
        }
        treeListMap[list[i].pid].children.push(list[i]);
        list.splice(i, 1);
        i--
      }
    }
    return list
  }
  export default listToTreeList